//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    class CellProtection : IOfficeXmlSerializable
    {
        private Boolean? _locked;
        private Boolean? _hidden;
        private const string xmlName = "protection";

        public bool? Locked
        {
            get { return _locked; }
            set { _locked = value; }
        }

        public bool? Hidden
        {
            get { return _hidden; }
            set { _hidden = value; }
        }

        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read(xmlName))
            {
                Locked = c.GetOptionalBoolean("locked");
                Hidden = c.GetOptionalBoolean("hidden");
            }
        }
        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write(xmlName))
            {
                c.SetOptionalBoolean("locked", Locked);
                c.SetOptionalBoolean("hidden", Hidden);
            }
        }
    }

}
